Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dotenv-defaults

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dotenv-defaults

dotenv... but with defaults!

  • 1.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
406K
decreased by-59.79%
Maintainers
1
Weekly downloads
 
Created

What is dotenv-defaults?

The dotenv-defaults package is an extension of the dotenv package that allows you to load environment variables from a .env file, with the added functionality of specifying default values in a .env.defaults file. This is particularly useful for setting up default configurations while allowing overrides through a .env file.

What are dotenv-defaults's main functionalities?

Load environment variables with defaults

This feature allows you to load environment variables from a .env file and fall back to default values specified in a .env.defaults file if the variables are not defined in the .env file.

const dotenv = require('dotenv-defaults');
dotenv.config();

console.log(process.env.MY_VARIABLE);

Specify custom paths for .env and .env.defaults files

This feature allows you to specify custom paths for your .env and .env.defaults files, giving you flexibility in organizing your configuration files.

const dotenv = require('dotenv-defaults');
dotenv.config({
  path: './config/.env',
  defaults: './config/.env.defaults'
});

console.log(process.env.MY_VARIABLE);

Override default values with environment variables

This feature allows you to override default values specified in the .env.defaults file with environment variables set in the .env file or directly in the environment.

const dotenv = require('dotenv-defaults');
process.env.MY_VARIABLE = 'override_value';
dotenv.config();

console.log(process.env.MY_VARIABLE);

Other packages similar to dotenv-defaults

Keywords

FAQs

Package last updated on 22 Jan 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc